home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Patches 1998 April / IRIX 6.4 Recommended-Required Patches April 1998.img / dist / 6.4_OCTANE / patchSG0002842.idb / usr / include / sys / fcal.h.z / fcal.h
C/C++ Source or Header  |  1998-03-05  |  7KB  |  251 lines

  1. #ifndef __FCAL
  2. #define __FCAL
  3.  
  4. /*
  5.  * This is a conversion table used for converting from target_ID to AL_PA.
  6.  * Note that target_ID's greater than 0x7E are illegal and 0x7E (aka AL_PA=0)
  7.  * is reserved for a fabric port.
  8.  */
  9. u_char tid_to_alpa[] = {
  10.   0xEF, 0xE8, 0xE4, 0xE2, 0xE1, 0xE0, 0xDC, 0xDA, /* 00 - 07 */
  11.   0xD9, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xCE, /* 08 - 0F */
  12.   0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC7, 0xC6, 0xC5, /* 10 - 17 */
  13.   0xC3, 0xBC, 0xBA, 0xB9, 0xB6, 0xB5, 0xB4, 0xB3, /* 18 - 1F */
  14.   0xB2, 0xB1, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, /* 20 - 27 */
  15.   0xA7, 0xA6, 0xA5, 0xA3, 0x9F, 0x9E, 0x9D, 0x9B, /* 28 - 2F */
  16.   0x98, 0x97, 0x90, 0x8F, 0x88, 0x84, 0x82, 0x81, /* 30 - 37 */
  17.   0x80, 0x7C, 0x7A, 0x79, 0x76, 0x75, 0x74, 0x73, /* 38 - 3F */
  18.   0x72, 0x71, 0x6E, 0x6D, 0x6C, 0x6B, 0x6A, 0x69, /* 40 - 47 */
  19.   0x67, 0x66, 0x65, 0x63, 0x5C, 0x5A, 0x59, 0x56, /* 48 - 4F */
  20.   0x55, 0x54, 0x53, 0x52, 0x51, 0x4E, 0x4D, 0x4C, /* 50 - 57 */
  21.   0x4B, 0x4A, 0x49, 0x47, 0x46, 0x45, 0x43, 0x3C, /* 58 - 5F */
  22.   0x3A, 0x39, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, /* 60 - 67 */
  23.   0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x27, 0x26, /* 68 - 6F */
  24.   0x25, 0x23, 0x1F, 0x1E, 0x1D, 0x1B, 0x18, 0x17, /* 70 - 77 */
  25.   0x10, 0x0F, 0x08, 0x04, 0x02, 0x01, 0x00,       /* 78 - 7E .. 7F is illegal */
  26. };
  27. #define INVALID_ALPA    ((u_char) -1)
  28. #define TID_2_ALPA(tid) (((tid) > 0x7E) ? INVALID_ALPA : tid_to_alpa[tid])
  29.  
  30. u_char alpa_to_tid[] = {
  31.   0x7e, 0x7d, 0x7c, 0xff, 0x7b, 0xff, 0xff, 0xff, /* 00 - 07 */
  32.   0x7a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x79, /* 08 - 0f */
  33.   0x78, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, /* 10 - 17 */
  34.   0x76, 0xff, 0xff, 0x75, 0xff, 0x74, 0x73, 0x72, /* 18 - 1f */
  35.   0xff, 0xff, 0xff, 0x71, 0xff, 0x70, 0x6f, 0x6e, /* 20 - 27 */
  36.   0xff, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x68, 0xff, /* 28 - 2f */
  37.   0xff, 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0xff, /* 30 - 37 */
  38.   0xff, 0x61, 0x60, 0xff, 0x5f, 0xff, 0xff, 0xff, /* 38 - 3f */
  39.   0xff, 0xff, 0xff, 0x5e, 0xff, 0x5d, 0x5c, 0x5b, /* 40 - 47 */
  40.   0xff, 0x5a, 0x59, 0x58, 0x57, 0x56, 0x55, 0xff, /* 48 - 4f */
  41.   0xff, 0x54, 0x53, 0x52, 0x51, 0x50, 0x4f, 0xff, /* 50 - 57 */
  42.   0xff, 0x4e, 0x4d, 0xff, 0x4c, 0xff, 0xff, 0xff, /* 58 - 5f */
  43.   0xff, 0xff, 0xff, 0x4b, 0xff, 0x4a, 0x49, 0x48, /* 60 - 67 */
  44.   0xff, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0xff, /* 68 - 6f */
  45.   0xff, 0x41, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0xff, /* 70 - 77 */
  46.   0xff, 0x3b, 0x3a, 0xff, 0x39, 0xff, 0xff, 0xff, /* 78 - 7f */
  47.   0x38, 0x37, 0x36, 0xff, 0x35, 0xff, 0xff, 0xff, /* 80 - 87 */
  48.   0x34, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33, /* 88 - 8f */
  49.   0x32, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, /* 90 - 97 */
  50.   0x30, 0xff, 0xff, 0x2f, 0xff, 0x2e, 0x2d, 0x2c, /* 98 - 9f */
  51.   0xff, 0xff, 0xff, 0x2b, 0xff, 0x2a, 0x29, 0x28, /* a0 - a7 */
  52.   0xff, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0xff, /* a8 - af */
  53.   0xff, 0x21, 0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0xff, /* b0 - b7 */
  54.   0xff, 0x1b, 0x1a, 0xff, 0x19, 0xff, 0xff, 0xff, /* b8 - bf */
  55.   0xff, 0xff, 0xff, 0x18, 0xff, 0x17, 0x16, 0x15, /* c0 - c7 */
  56.   0xff, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0xff, /* c8 - cf */
  57.   0xff, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0xff, /* d0 - d7 */
  58.   0xff, 0x08, 0x07, 0xff, 0x06, 0xff, 0xff, 0xff, /* d8 - df */
  59.   0x05, 0x04, 0x03, 0xff, 0x02, 0xff, 0xff, 0xff, /* e0 - e7 */
  60.   0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, /* e8 - ef */
  61.   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* f0 - f7 */
  62.   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* f8 - ff */
  63. };
  64. #define ALPA_2_TID(alpa) (((alpa) > 255) ? 0xFF : alpa_to_tid[alpa])
  65.  
  66. #pragma pack(1)
  67. struct fc_basic_accept_payload
  68. {
  69.     uint8_t        seqid_valid;
  70.     uint8_t        last_seqid;
  71.     uint16_t    reserved;
  72.     uint16_t    ox_id;
  73.     uint16_t    rx_id;
  74.     uint16_t    seqcnt_low;
  75.     uint16_t    seqcnt_high;
  76. };
  77.  
  78. struct fc_basic_reject_payload
  79. {
  80.     uint8_t        reserved;
  81.     uint8_t        reason_code;
  82.     uint8_t        reason_explanation;
  83.     uint8_t        vendor_unique;
  84. };
  85.  
  86.  
  87. /*
  88.  * Port Login structures
  89.  */
  90.     /*
  91.      * N_port common service parameters
  92.      */
  93.     struct fc_nport_common_service_param
  94.     {
  95.         uint16_t    fcph_version;
  96.         uint16_t    bbcredit;
  97.         uint16_t    common_features;
  98.         uint16_t    rcvdata_size;
  99.         uint16_t    max_concurrent_seq;
  100.         uint16_t    reloffset;
  101.         uint32_t    e_d_tov;
  102.     };
  103.  
  104.     /*
  105.      * Class 1, 2, and 3 service parameters
  106.      */
  107.     struct fc_class_service_param
  108.     {
  109.         uint16_t    service_options;
  110.         uint16_t    initiator_ctrl;
  111.         uint16_t    target_ctrl;
  112.         uint16_t    rcv_data_size;
  113.         uint16_t    concurrent_seq;
  114.         uint16_t    eecredit;
  115.         uint16_t    openseq_per_exchg;
  116.         uint16_t    reserved;
  117.     };
  118.  
  119. /*
  120.  * The PLOGI payload and PLOGI ACC payload structures are identical.
  121.  */
  122. struct fc_plogi_payload
  123. {
  124.     uint32_t                command_code;
  125.  
  126.     struct fc_nport_common_service_param    common_service_param;
  127.  
  128.     uint64_t                port_name;
  129.     uint64_t                node_name;
  130.  
  131.     /* Class 1, 2, 3 service parameters */
  132.     struct fc_class_service_param        class1_service_param;
  133.     struct fc_class_service_param        class2_service_param;
  134.     struct fc_class_service_param        class3_service_param;
  135.  
  136.     uint8_t                    reserved[16];
  137.     uint8_t                    vendor_version[16];
  138. };
  139.  
  140.  
  141. /*
  142.  * Port Logout structures
  143.  */
  144. struct fc_logo_payload
  145. {
  146.     uint32_t            command_code;
  147.     uint8_t                reserved;
  148.     uint8_t                nport_id[3];
  149.     struct fc_node_port_name    port_name;
  150. };
  151.  
  152. struct fc_logo_accept
  153. {
  154.     uint32_t        command_code;
  155. };
  156.  
  157.  
  158. /*
  159.  * Process Login structures
  160.  * The PRLI, PRLI ACC, PRLO, and PRLO accept payloads are all very
  161.  * similar in structure.  Certain fields are not used and should be
  162.  * zeroed in some payloads.
  163.  */
  164. struct fc_prli_payload
  165. {
  166.     uint8_t            command_code;
  167.     uint8_t            page_length;
  168.     uint16_t        payload_length;
  169.     uint8_t            type_code;
  170.     uint8_t            type_code_extension;
  171.     uint16_t        orig_proc_valid:1,
  172.                 resp_proc_valid:1,
  173.                 est_image_pair:1,
  174.                 reserved0:1,
  175.                 response_code:4,
  176.                 reserved1:8;
  177.     uint32_t        orig_proc_associator;
  178.     uint32_t        resp_proc_associator;
  179.     uint8_t            reserved2[3];
  180.     uint8_t            svc_param;
  181. };
  182. #define FC_PRLI_PAYLOAD_LENGTH 0x14
  183. #define FC_PRLI_TYPE_CODE 0x8
  184. #define FC_PRLI_SVC_PARAM_SEND 0x22
  185. #define FC_PRLI_SVC_PARAM_DESIRED 0x12
  186.  
  187.  
  188. struct fc_rrq_payload
  189. {
  190.     uint32_t        command_code;
  191.     uint8_t            reserved0;
  192.     uint8_t            originator_sid[3];
  193.     uint16_t        ox_id;
  194.     uint16_t        rx_id;
  195.     uint8_t            association_header[32];
  196. };
  197.  
  198.  
  199. /*
  200.  * Address discovery and Address disconver accept payloads are
  201.  * similar.  The accept payload fields correspond to responder
  202.  * while the ADISC payload corresponds to originator.
  203.  */
  204. struct fc_adisc_payload
  205. {
  206.     uint32_t            command_code;
  207.     uint8_t                reserved0;
  208.     uint8_t                hard_address[3];
  209.     struct fc_node_port_name    port_name;
  210.     struct fc_node_port_name    node_name;
  211.     uint32_t            reserved:8,
  212.                     nport_id:24;
  213. };
  214.  
  215. struct fc_lsrjt_payload
  216. {
  217.     uint32_t            command_code;
  218.     struct fc_basic_reject_payload    reject;
  219. };
  220.  
  221.  
  222. /*
  223.  * The size of the sense_data field at the end of the structure
  224.  * is variable, but doesn't need to be defined here, since it is
  225.  * at the end of the structure.
  226.  */
  227. struct fc_fcprsp_info
  228. {
  229.     uint8_t                reserved3[3];
  230.     uint8_t                rsp_code;
  231.     uint8_t                reserved4[4];
  232. };
  233.  
  234. struct fc_fcprsp_payload
  235. {
  236.     uint8_t                reserved[10];
  237.     uint8_t                reserved2:4,
  238.                     resid_underrun:1,
  239.                     resid_overrun:1,
  240.                     sense_length_valid:1,
  241.                     rsp_length_valid:1;
  242.     uint8_t                scsi_status;
  243.     uint32_t            resid_count;
  244.     uint32_t            sense_length;
  245.     uint32_t            rsp_length;
  246.     uint8_t                addl_info[1];
  247. };
  248. #pragma pack(0)
  249.  
  250. #endif
  251.